package ace.module.sms.core.impl.manager;

import ace.cmp.data.spring.data.jdbc.querydsl.rsql.core.manager.DtoManager;
import ace.module.sms.api.model.dto.SmsSendRecordDto;
import ace.module.sms.core.impl.dao.entity.SmsApplication;
import ace.module.sms.core.impl.dao.entity.SmsSendRecord;
import ace.module.sms.core.impl.dao.entity.SmsSupplier;
import java.util.Map;

/**
 * 短信发送记录 spring data jdbc querydsl rsql manager.
 *
 * @author Caspar
 */
public interface SmsSendRecordManager
    extends DtoManager<SmsSendRecord, Long, SmsSendRecordDto> {

  SmsSendRecord addSendingRecord(
      SmsApplication smsApplication, SmsSupplier smsSupplier, String phoneNumber, String content);

  void updateSuccess(Long id, String sendResultRemark);

  void updateFailure(Long id, String sendResultRemark);

  /**
   * template content var name ${varName} string replace
   * example: templateContent:"hello ${var1}" contentParams: "{'var1':'world'}" = "hello world"
   *
   * @param templateContent
   * @param contentParams
   * @return
   */
  String transformSmsContent(String templateContent, Map<String, String> contentParams);
}
